home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / examples / demo / demosrc / startmes.pro < prev    next >
Text File  |  1997-07-08  |  2KB  |  57 lines

  1. ;
  2. ;  PURPOSE This function creates a start up message window.
  3. ;          Returns the draw base ID.
  4. ;
  5. function Startmes, $
  6.                    Name, $      ;Demo name (optional)
  7.                    GROUP = group, $ ;  IN:(opt) group leader
  8.                    STATUS = status, $ ;If set, create a status line and
  9.                                 ;initialize it to this text
  10.                    UPDATE = updatebase ;Set to the Widget ID of the startup
  11.                                 ;message window to update the status
  12.                                 ;line with the text in Name. 
  13. ; Example:
  14. ; Wid = Startmes('My Demo', STATUS='')  ;Create startup window with status line.
  15. ; Dummy = Startmes('Loading vertex data', UPDATE=Wid) ;Update status message
  16. ;
  17.  
  18. if n_elements(updatebase) ne 0 then begin ;Update existing message window?
  19.     WIDGET_CONTROL, updatebase, GET_UVALUE=txtwid
  20.     if txtwid ne 0 then WIDGET_CONTROL, txtwid, SET_VALUE=name
  21.     return, updatebase
  22. endif
  23.  
  24.     ;  Otherwise set up the starting up message.
  25.     ;  Get the screen size and set an offset.
  26.     ;
  27.     DEVICE, GET_SCREEN_SIZE = screenSize
  28.     xstext = screenSize[0]/6
  29.     ystext = 30
  30.     xoff = (screenSize[0] - xstext)/2.0
  31.     yoff = (screenSize[1] - ystext) /2.0
  32.  
  33.     if N_ELEMENTS(group) eq 0 then group = 0L
  34.     if N_ELEMENTS(name) ne 0 then addl = name else addl = 'the Demo'
  35.  
  36.     drawbase = WIDGET_BASE(YOFFSET=yoff, XOFFSET=xoff, /COLUMN, $
  37.                            TLB_FRAME_ATTR=27, /FRAME, GROUP_LEADER=group)
  38.  
  39.     ;  Create the starting up window.
  40.     ;
  41.     Label = WIDGET_LABEL (drawbase, XSIZE=xstext, SCR_XSIZE=xstext, $
  42.         SCR_YSIZE=ystext, YSIZE=ystext, /ALIGN_CENTER, $
  43.         VALUE='Starting ' + addl, $
  44.         FRAME=0)
  45.  
  46.     if N_ELEMENTS(status) ne 0 then $ ;New style, add a status window
  47.       textwin = WIDGET_TEXT (drawbase, XSIZE=40, YSIZE=1, /ALIGN_CENTER,   $
  48.                              Value = status, FRAME=0) $
  49.     else textwin = 0L
  50.  
  51.     ;  Realize the starting up  message window.
  52.     ;
  53.     WIDGET_CONTROL, drawbase, /REALIZE, SET_UVALUE=textwin
  54.  
  55.     RETURN, drawbase
  56. end
  57.